package leetcode.day_2021_03_22_2021_03_28;

/**
 * 70. 爬楼梯
 * https://leetcode-cn.com/problems/climbing-stairs/
 */
public class LeetCode0070 {
    public int climbStairs(int n) {
        if (n==1) {
            return 1;
        }
        if (n==2) {
            return 2;
        }
        int a = 1, b = 2;
        int c = 0;
        for (int i=3; i<=n; i++) {
            c = a+b;
            a = b;
            b = c;
        }
        return c;
    }
}
